.NET Framework Class Library |
ConcurrentBag<(Of <(T>)>)..::.CopyTo Method |
ConcurrentBag<(Of <(T>)>) Class See Also Send Feedback |
Copies the ConcurrentBag<(Of <(T>)>) elements to an existing
one-dimensional Array, starting at the specified array
index.
Namespace:
System.Collections.Concurrent
Assembly:
System.Threading (in System.Threading.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Sub CopyTo ( _ array As T(), _ index As Integer _ ) |
C# |
---|
public void CopyTo( T[] array, int index ) |
Parameters
- array
- Type: array<
T
>[]()[]
The one-dimensional Array that is the destination of the elements copied from the ConcurrentBag<(Of <(T>)>). The Array must have zero-based indexing.
- index
- Type: System..::.Int32
The zero-based index in array at which copying begins.
Implements
IProducerConsumerCollection<(Of <(T>)>)..::.CopyTo(array<T>[]()[], Int32)Exceptions
Exception | Condition |
---|---|
System..::.ArgumentNullException | array is a null reference (Nothing in Visual Basic). |
System..::.ArgumentOutOfRangeException | index is less than zero. |
System..::.ArgumentException | index is equal to or greater than the length of the array -or- the number of elements in the source ConcurrentBag<(Of <(T>)>) is greater than the available space from index to the end of the destination array. |